import xadmin

from apps.blogmessage.models import BlogMessage,BlogTag,AboutMessage

class BlogMessageAdmin(object):
    list_display = ["name", "click_nums", "last_time", "add_time"]
    search_fields = ["name", "click_nums", "last_time", "add_time"]
    list_filter = ["name", "click_nums", "last_time", "add_time"]
    list_editable = ["name", "click_nums", "last_time", "add_time"]
    # 只读
    readonly_fields = ["click_nums","add_time"]
    style_fields = {"detail": "ueditor"}

class BlogTagAdmin(object):
    list_display = ["tag", "add_time"]
    search_fields = ["tag", "add_time"]
    list_filter = ["tag", "add_time"]
    list_editable = ["tag", "add_time"]
    # 只读
    readonly_fields = ["add_time"]

class AboutMessageAdmin(object):
    list_display = ["name", "click_nums", "last_time", "add_time"]
    search_fields = ["name", "click_nums", "last_time", "add_time"]
    list_filter = ["name", "click_nums", "last_time", "add_time"]
    list_editable = ["name", "click_nums", "last_time", "add_time"]
    # 只读
    readonly_fields = ["click_nums", "add_time"]
    style_fields = {"detail": "ueditor"}


xadmin.site.register(BlogMessage, BlogMessageAdmin)
xadmin.site.register(BlogTag, BlogTagAdmin)
xadmin.site.register(AboutMessage, AboutMessageAdmin)

